package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.model.request.StockRemindRequest;
import com.ytjj.qmyx.admin.service.ProductActivityService;
import com.ytjj.qmyx.admin.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 *
 * @Version: 1.0
 */
@RestController
@RequestMapping("/stockRemind")
public class StockRemindController {

    @Autowired
    private ProductService productService;

    @Autowired
    private ProductActivityService productActivityService;


    @PostMapping("/list")
    public CommonResult getStockRemind(@RequestBody StockRemindRequest stockRemindRequest) {
        // 商品类型 0-普通商品 1-活动商品
        if (stockRemindRequest.getProductType() == 0) {
            return CommonResult.success(productService.getStockInfo(stockRemindRequest));
        } else {
            return CommonResult.success(productActivityService.getStockInfo(stockRemindRequest));
        }
    }

}
